﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="Controls_TopHeader" Codebehind="TopHeader.ascx.cs" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Core.Controls" Namespace="Core.Controls.Telerik" TagPrefix="style" %>
<%@ Register Assembly="Core.Controls" Namespace="Core.Controls.Message" TagPrefix="cc1" %>


<cc1:messagesetting ID="mssUsedMessageList" runat="server" 
    meta:resourcekey="mssUsedMessageListResource1">
        <Items>
            <cc1:Message Code="10060"/>                    
        </Items>
</cc1:messagesetting>
<div id="topheader_topBanner" class="topBanner">
    <asp:ImageButton OnClientClick="return false;"  ID="imgTopBanner"  style=" cursor:default"   Width="100%" 
        Height="100%" runat="server" meta:resourcekey="imgTopBannerResource1" />
</div>  
<div class="divClear"></div>

<div class="topMenu">  
    
    <telerik:RadMenu ID="RadMenuOne" runat="server" Width="100%" BorderWidth="0px" 
        BorderStyle="None" meta:resourcekey="RadMenuOneResource1">
         
    </telerik:RadMenu>
        
</div>          
<div class="divClear"></div>

<div class="divUserInfo">
    <div class="userInfo">
        <asp:Label ID="lblUsername_L" runat="server"    Text="Tên đăng nhập:" 
            meta:resourcekey="lblUsername_LResource1"></asp:Label>
        <asp:Label ID="lblUsername_V" CssClass="info" runat="server" Text="" 
            meta:resourcekey="lblUsername_VResource1"></asp:Label> - 
        <asp:Label ID="lblEmpName_L"  runat="server" Text="Họ tên:" 
            meta:resourcekey="lblEmpName_LResource1"></asp:Label>
        <asp:Label ID="lblEmpName_V" CssClass="info" runat="server" 
            Text="" meta:resourcekey="lblEmpName_VResource1"></asp:Label> -
        <asp:Label ID="lblUserGroup_L"  runat="server" Text="Thuộc nhóm: " 
            meta:resourcekey="lblUserGroup_LResource1"></asp:Label> 
        <asp:Label ID="lblUserGroup_V" CssClass="info" runat="server" Text="" 
            meta:resourcekey="lblUserGroup_VResource1"></asp:Label>
    </div>

    <div class="language">    
        
        <asp:ImageButton  ID="btnChangeToEN" ToolTip="Thay đổi ngôn ngữ"  runat="server" onkeypress="return false;"
            ImageUrl="~/Images/flag_en.gif" Height="18px" CssClass="topToolbar" 
            onclick="btnChangeToEN_Click" meta:resourcekey="btnChangeToENResource1" />
        <asp:ImageButton ID="btnChangeToVN" ToolTip="Thay đổi ngôn ngữ"  runat="server"  onkeypress="return false;"
            ImageUrl="~/Images/flag_vn.gif" Height="18px" CssClass="topToolbar" 
            onclick="btnChangeToVN_Click" meta:resourcekey="btnChangeToVNResource1" />
        <asp:ImageButton ID="btnAddFavorites" ToolTip="Add favorite"  runat="server"  
            ImageUrl="~/Images/favorite_add.png"   CssClass="topToolbar" 
            meta:resourcekey="btnAddFavoritesResource1"   />       

         <asp:ImageButton ID="btnSetting" runat="server"  ToolTip="Thiết lập hiển thị" OnClientClick="OpenPopupSetting(this); return false;"
            ImageUrl="~/Images/setting.gif" Height="18px"  CssClass="topToolbar" meta:resourcekey="btnSettingResource1" 
              />
        <asp:ImageButton ID="btnLogOut" runat="server" onclick="btnLogout_Click" 
            ImageUrl="~/Images/logoff.gif" Height="18px"  CssClass="topToolbar" 
            meta:resourcekey="btnLogOutResource1"   />
       
        <telerik:RadComboBox ID="cboGlobalTheme" runat="server" Width="80px"  DropDownWidth="150px"
            AutoPostBack="True" CssClass="topCombo" 
            onselectedindexchanged="cboGlobalTheme_SelectedIndexChanged" 
            meta:resourcekey="cboGlobalThemeResource1">                
                <Items>                    
                    <telerik:RadComboBoxItem  Value="Default" Text="Default" 
                        meta:resourcekey="RadComboBoxItemResource1"  />
                    <telerik:RadComboBoxItem  Value="Office2007" Text="Office2007" 
                        meta:resourcekey="RadComboBoxItemResource2"/>
                   
                </Items>
        </telerik:RadComboBox>
     
       
       
    </div>
    <div class="divClear"></div>       
</div>
<div class="divClear"></div>

<div id="topheader_divSetting" class="divSetting" style="display:none">  
    <div class="headerSession">
        <asp:Label ID="lblSettingHeader" runat="server" 
            Text="Chọn chế độ hiển thị của trang" 
            meta:resourcekey="lblSettingHeaderResource1"></asp:Label>
        </div>
        <asp:CheckBox ID="chkShowFilter"  
        Text="Hiển thị chức năng tìm kiếm trên lưới" runat="server" 
        meta:resourcekey="chkShowFilterResource1" /><br />
        <asp:CheckBox ID="chkShowLeftMenu" Text="Hiển thị menu trái" runat="server" 
        meta:resourcekey="chkShowLeftMenuResource1" /><br />
        <asp:CheckBox ID="chkShowTop" Text="Hiển thị banner" runat="server" 
        meta:resourcekey="chkShowTopResource1" />
      <div class="divSeperator"></div>
      <br />
       <br />
      <div class="formTitle" style=" border-left:none; border-right:none; border-bottom:none;" >
        <div class="formToolbar">
             <asp:Button ID="btnApply" runat="server" Text="Đồng ý" OnClick="btnSaveSetting_Click" OnClientClick="return SaveSetting(this)" 
                CssClass="btnApply" meta:resourcekey="btnApplyResource1" />
            <asp:Button ID="btnClose" OnClientClick="CloseSetting(this); return false;" 
                 runat="server" Text="Đóng"  
            CssClass="btnClose" meta:resourcekey="btnCloseResource1" />
        </div>
    </div>
     
</div>

<telerik:RadCodeBlock  ID="RadCodeBlock1" runat="server"> 
    <script type="text/javascript">
    function OpenPopupAddFavorite(functionid, moduleId) {       
        var oWnd = radopen("../MdlSYS/SYS_PopAddFavorites.aspx?FunctionId=" + functionid + "&ModuleId=" + moduleId, null);
        oWnd.set_width(850);
        oWnd.set_height(550);       
        oWnd.setActive(true);
    }
    function AddFavorite() {
        new Message().ShowObject(alertmsg_10060);
    }
    function OpenPopupSetting(obj) {


        var popup = document.getElementById("topheader_divSetting");
        var chkFilter = document.getElementById("<%=chkShowFilter.ClientID %>");
        var chkShowLeftMenu = document.getElementById("<%=chkShowLeftMenu.ClientID %>");
        var chkShowTop = document.getElementById("<%=chkShowTop.ClientID %>");

        var left = new Cookie().getCookie("Master_LeftCollapse");
        var filter = new Cookie().getCookie("rgFilterRow_Status");
        var top = new Cookie().getCookie("Master_TopCollapse");
        if (left == "1") chkShowLeftMenu.checked = false;
        else chkShowLeftMenu.checked = true;

        if (top == "1") chkShowTop.checked = false;
        else chkShowTop.checked = true;

        if (filter == "none" || filter == null || filter=='') chkFilter.checked = false;
        else chkFilter.checked = true;

        popup.style.display = "block";
        var top = 130;      
        var right = 140;
        popup.style.top = top + "px";
        popup.style.right = right + "px";
    }
    function CloseSetting(obj) {        
       
        var popup = document.getElementById("topheader_divSetting");
        popup.style.display = "none";
    }

    function SaveSetting(obj) {
        var chkFilter = document.getElementById("<%=chkShowFilter.ClientID %>");
        var chkShowLeftMenu = document.getElementById("<%=chkShowLeftMenu.ClientID %>");
        var chkShowTop = document.getElementById("<%=chkShowTop.ClientID %>");

        var filterStatus = "none", Master_LeftCollapse = "1", Topheader_HideBanner = "1";   
           
        if (chkFilter.checked) filterStatus = "table-row";
        if (chkShowLeftMenu.checked) Master_LeftCollapse = "0";
        if (chkShowTop.checked) Topheader_HideBanner = "0";

        new Cookie().setCookie("Master_LeftCollapse", Master_LeftCollapse,7);
        new Cookie().setCookie("rgFilterRow_Status", filterStatus,7);
        new Cookie().setCookie("Master_TopCollapse", Topheader_HideBanner, 7);
        return true;
    }
   
</script>
</telerik:RadCodeBlock>